package controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import pojo.User;
import service.UserService;

@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("/index")
    public String index(){
        // 逻辑视图名
        return "index";
    }

    @RequestMapping("/login")
    public String login(User user){
        // 登录逻辑
        boolean flag = userService.login(user);
        if(flag){
            // /WEB-INF/user/list.jsp
            return "index";
        } else {
            return "login";
        }
    }

    // 全查询
    @RequestMapping("/list/{currentPage}")
    public String list(User user,@PathVariable("currentPage") int currentPage){


        // 补全代码
        return "list";
    }


}
